# Maintainer: David Runge <dvzrv@archlinux.org>

pkgname=qxgedit
pkgver=0.9.11
pkgrel=1
pkgdesc="GUI for editing MIDI System Exclusive files for XG devices (eg. Yamaha DB50XG)"
arch=(loong64 x86_64)
url="https://qxgedit.sourceforge.io/"
license=(GPL-2.0-or-later)
groups=(pro-audio)
depends=(
  gcc-libs
  glibc
  hicolor-icon-theme
  qt6-base
  qt6-svg
)
makedepends=(
  alsa-lib
  cmake
  qt6-tools
)
source=(https://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.gz)
sha512sums=('5e1f65921b46ca1c3c2539f6e42593cbeef67dc88e7e7ad57c76e49e0fde175f7ec1ee290950324f9ce82d504cda47675a39710386ee66a4952466fc686bdbc3')
b2sums=('e788fb99fda95c436976aa236a230c3e4a879e9ea04e05f11abbb1cd1d7b301300371fec11528659a385cf62e3dda9901106dde16217fd45c4810959a339dd93')

build() {
  local cmake_options=(
    -B build
    -D CMAKE_BUILD_TYPE=None
    -D CMAKE_INSTALL_PREFIX=/usr
    -D CONFIG_QT6=ON
    -S $pkgname-$pkgver
    -W no-dev
  )

  cmake "${cmake_options[@]}"
  cmake --build build --verbose
}

package() {
  depends+=(
    alsa-lib libasound.so
  )

  DESTDIR="$pkgdir" cmake --install build
  install -vDm 644 $pkgname-$pkgver/{ChangeLog,README} -t "$pkgdir/usr/share/doc/$pkgname/"
}
